package com.lovi.string_;

/**
 * 关于String本质是final char[]
 */
public class String02 {
    public static void main(String[] args) {
        String str1 = "abc";
        String str2 = "b";
        String str3 = new String("de");
        String str4 = new String("def");
        str4 = str3;
        str1 = str2;
        str2 = str3;
        //以上不影响，不过字符串常量池有 "abc" "b" "de" "def"的地址，
        // 堆中有 "de" "def" 指向常量池的地址
        final char[] value = {'a', 'b', 'c'};
        char[] chars = {'d', 'e', 'f'};
        value[0] = 'A';
//        value = chars;//无法将值赋给 final 变量 'value',不能修改value数组的地址

    }
}
